package com.tony.service;

import com.tony.dao.MoneyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;



@Service
public class MoneyServiceImpl implements MoneyService {

    @Autowired
    private MoneyMapper moneyMapper;


    @Override
    public void incrementMoney(Integer m, String username) {
        moneyMapper.incrementMoney(m, username);
    }

    @Override
    public void decrementMoney(Integer m, String username) {
        moneyMapper.decrementMoney(m, username);
    }

    @Transactional
    public void trans(){
        incrementMoney(100, "tony");
        int i=10/0;
        decrementMoney(100, "jack");
    }
}
